<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>短信历史管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#btnExport").click(function(){
				top.$.jBox.confirm("确认要导出短信历史数据吗？","系统提示",function(v,h,f){
					if(v=="ok"){
						$("#searchForm").attr("action","${ctx}/crab/msgHistroy/export");
						$("#searchForm").submit();
					}
				},{buttonsFocus:1});
				top.$('.jbox-body .jbox-icon').css('top','55px');
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").attr("action","${ctx}/crab/msgHistroy/list");
			$("#searchForm").submit();
        	return false;
        }
		function clearForm(){
			$("#mobile").val('');
			$("#searchForm").attr("action","${ctx}/crab/msgHistroy/list");
			$("#searchForm").submit();
        	return false;
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/crab/msgHistroy/">短信历史列表</a></li>
		<%-- <shiro:hasPermission name="crab:msgHistroy:edit"><li><a href="${ctx}/crab/msgHistroy/form">短信历史添加</a></li></shiro:hasPermission>  --%>
	</ul>
	<shiro:hasPermission name="crab:msgHistroy:edit">
	<form:form id="searchForm" modelAttribute="msgHistroy" action="${ctx}/crab/msgHistroy/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" callback="page();"/>
		<ul class="ul-form">
			<li><label>手机号：</label>
				<form:input path="mobile" htmlEscape="false" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" onclick="return page();"/></li>
			<li class="btns"><input id="btnClear" class="btn btn-primary" type="button" onclick="clearForm()" value="重置"/></li>
			<li class="btns"><input id="btnExport" class="btn btn-primary" type="button" value="导出"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	</shiro:hasPermission>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>用户手机号</th>
				<th>推送时间</th>
				<th>推送内容</th>
				<th>推送结果</th>
				<shiro:hasPermission name="crab:msgHistroy:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="msgHistroy">
			<tr>
				<td>
					${msgHistroy.mobile}
				</td>
				<td>
					<fmt:formatDate value="${msgHistroy.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${msgHistroy.content}
				</td>
				<td>
					<c:if test="${msgHistroy.state==0}">成功</c:if>
					<c:if test="${msgHistroy.state==1}">失败</c:if>
				</td>
				<shiro:hasPermission name="crab:msgHistroy:edit"><td>
					<c:if test="${msgHistroy.state==1}"><a href="${ctx}/crab/msgHistroy/pushMessage?id=${msgHistroy.id}">信息推送</a></c:if>
    				<%-- <a href="${ctx}/crab/msgHistroy/form?id=${msgHistroy.id}">修改</a>
					<a href="${ctx}/crab/msgHistroy/delete?id=${msgHistroy.id}" onclick="return confirmx('确认要删除该短信历史吗？', this.href)">删除</a> --%>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>